package com.example.chapter09;

public class test1 {


    public static void main(String[] args) {
        String str = "Hello";
        int length = str.length(); // length = 5
        String str2 = "Hello";
        char firstChar = str2.charAt(0); // firstChar = 'H'
        String str3 = "Hello World";
        String subStr = str3.substring(6); // subStr = "World"

        String str4 = "Hello";
        String str5 = "World";
        String result = str4 + " " + str5; // result = "Hello World"

        String str6 = "Hello";
        String upperCaseStr = str6.toUpperCase(); // upperCaseStr = "HELLO"

        String str7 = "apple,banana,orange";
        String[] fruits = str7.split(","); // fruits = ["apple", "banana", "orange"]

        String str8 = "   Hello   ";
        String trimmedStr = str8.trim(); // trimmedStr = "Hello"

        String str9 = "Hello";
        char[] chars = new char[5];
        str9.getChars(0, 5, chars, 0);
        System.out.println(chars); // 输出: Hello

        String str10 = "Hello";
        char[] chars2 = str.toCharArray();
        System.out.println(chars2); // 输出: [H, e, l, l, o]

        String str11 = "Hello";
        String str12 = "Hello";
        System.out.println(str11.equals(str12)); // 输出: true

        String str13 = "Hello";
        String str14 = "hello";
        System.out.println(str13.equalsIgnoreCase(str14)); // 输出: true
    }

}
